package chapter.seventh.item41;

import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

public class CollectionClassifier {
	
	public static String classify(Set<?> s){
		return "Set";
	}
	
	public static String classify(List<?> list){
		return "List";
	}
	
	public static String classify(Collection<?> c){
		return "Unkown Collection";
	}
	
	/**
	 * 检验重载方法的选择
	 * @param args
	 */
	public static void main(String[] args) {
		Collection<?>[] collections = {
				new HashSet<String>(),
				new ArrayList<BigInteger>(),
				new HashMap<String,String>().values()
		};
		for(Collection<?> c:collections)
			System.out.println(classify(c));
	}
}
